package vim.meet.javassist;

import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.Loader;
import javassist.NotFoundException;

public class JavassistTranslatorStart {
    
    public static void main(String[] args) {
        ClassPool cp = ClassPool.getDefault();
        Loader loader = new Loader();
        System.out.println("before add translator...");
        try {
            loader.addTranslator(cp, new MyTranslator());
        } catch (NotFoundException e) {
            e.printStackTrace();
        } catch (CannotCompileException e) {
            e.printStackTrace();
        }
        System.out.println("after add translator...");
        String name = MyTranslator.class.getName();
        System.out.println(name);
        try {
            loader.run(name, args);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

}
